package com.learn.springcloud.first.web;

import com.alibaba.fastjson.JSON;
import com.learn.springcloud.first.web.model.HandleResult;
import com.learn.springcloud.first.web.model.UserInfoModel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @auth lwt
 * @data 2022/8/24
 */
@Slf4j
@RestController
public class ClientFeignTestController implements ClientFeignTestApi {


    @Override
    public HandleResult<UserInfoModel> testPost(@RequestBody UserInfoModel userInfoModel) {
        log.info("serviceFirst-testPost userInfo={}", JSON.toJSONString(userInfoModel));
        userInfoModel.setRemarks("接受到并修改了备注信息");
        return HandleResult.success(userInfoModel);
    }

    @Override
    public HandleResult<UserInfoModel> testGet(UserInfoModel userInfoModel) {
        log.info("serviceFirst-testGet userInfo={}", JSON.toJSONString(userInfoModel));
        userInfoModel.setRemarks("接受到并修改了备注信息");
        return HandleResult.success(userInfoModel);
    }

    @Override
    public HandleResult<UserInfoModel> testPostMapping(@RequestBody UserInfoModel userInfoModel) {
        log.info("serviceFirst-testPostMapping userInfo={}", JSON.toJSONString(userInfoModel));
        userInfoModel.setRemarks("接受到并修改了备注信息");
        return HandleResult.success(userInfoModel);
    }

    @Override
    public HandleResult<UserInfoModel> testGetMapping(UserInfoModel userInfoModel) {
        log.info("serviceFirst-testGetMapping userInfo={}", JSON.toJSONString(userInfoModel));
        userInfoModel.setRemarks("接受到并修改了备注信息");
        return HandleResult.success(userInfoModel);
    }
}
